package main

import (
	"fmt"
)

func main() {
	var x int

	fmt.Println("name", "local", "address", "value")

	x = 10
	fmt.Println("x", x, &x)
	// x 10 0x20818a220

	// declare pointer
	var num *int
	fmt.Println("num", num, &num)
	// num <nil> 0x2081c6020

	val := new(int)
	fmt.Println("val", val, &val, *val)
	// val 0x20818a2d8 0x2081c6028 0

	num = new(int)
	fmt.Println("num", num, &num, *num)
	// num 0x20818a308 0x2081c6020 0
	*num = x // set value
	fmt.Println("num", num, &num, *num)
	// num 0x20818a308 0x2081c6020 10
	val = &x // set address
	// val 0x20818a220 0x2081c6028 10
}
